VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmReporteFacturas 
   BackColor       =   &H80000013&
   Caption         =   "Reporte de Facturas"
   ClientHeight    =   4995
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7875
   Icon            =   "frmResumenFacturasCliente.frx":0000
   LinkTopic       =   "Form2"
   ScaleHeight     =   4995
   ScaleWidth      =   7875
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame FraCliente 
      BackColor       =   &H80000009&
      Caption         =   "1. Seleccionar Cliente"
      Height          =   1575
      Left            =   120
      TabIndex        =   5
      Top             =   120
      Width           =   7455
      Begin VB.CheckBox chkTodos 
         Caption         =   "Todos"
         Height          =   255
         Left            =   240
         TabIndex        =   9
         Top             =   1080
         Width           =   1455
      End
      Begin CtaCte.txtCliente txtCliente1 
         Height          =   735
         Left            =   120
         TabIndex        =   6
         Top             =   240
         Width           =   5655
         _extentx        =   9975
         _extenty        =   1296
      End
   End
   Begin VB.Frame fraperiodo 
      BackColor       =   &H80000013&
      Caption         =   "2. Seleccionar Periodo"
      Height          =   1815
      Left            =   120
      TabIndex        =   2
      Top             =   1800
      Width           =   7455
      Begin MSComCtl2.DTPicker dtpHasta 
         Height          =   375
         Left            =   3720
         TabIndex        =   8
         Top             =   600
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   661
         _Version        =   393216
         Format          =   39452673
         CurrentDate     =   39653
      End
      Begin MSComCtl2.DTPicker dtpDesde 
         Height          =   375
         Left            =   1320
         TabIndex        =   7
         Top             =   600
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   661
         _Version        =   393216
         Format          =   39452673
         CurrentDate     =   39653
      End
      Begin VB.CommandButton cmdVer 
         Caption         =   "&Ver"
         Height          =   855
         Left            =   5520
         Picture         =   "frmResumenFacturasCliente.frx":0442
         Style           =   1  'Graphical
         TabIndex        =   0
         Top             =   240
         Width           =   1335
      End
      Begin VB.Label lblhasta 
         BackColor       =   &H80000013&
         Caption         =   "Hasta:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2880
         TabIndex        =   4
         Top             =   600
         Width           =   735
      End
      Begin VB.Label lbldesde 
         BackColor       =   &H80000013&
         Caption         =   "Desde:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   3
         Top             =   600
         Width           =   855
      End
   End
   Begin VB.CommandButton cmdSalir 
      Caption         =   "Ce&rrar"
      Height          =   855
      Left            =   6120
      Picture         =   "frmResumenFacturasCliente.frx":09CC
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   3840
      Width           =   1455
   End
End
Attribute VB_Name = "frmReporteFacturas"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cliente As String
Dim imprime As Integer

Private Sub cmdVer_Click()
If dtpHasta.Value < dtpDesde.Value Then
    MsgBox "La fecha inicial debe ser anterior o igual a la final", vbExclamation, "Atencion"
Else

    Conectar
    rptResumenFacturasCliente.Sections.item("cmdResumen_Header").Controls("rptNombre").Caption = parametro(1)
    rptResumenFacturasCliente.Sections.item("cmdResumen_Header").Controls("rptDe").Caption = "De: " & parametro(2)
    rptResumenFacturasCliente.Sections.item("cmdResumen_Header").Controls("lbldel").Caption = dtpDesde.Value
    rptResumenFacturasCliente.Sections.item("cmdResumen_Header").Controls("lblal").Caption = dtpHasta.Value
    
    cons = " SHAPE {select  id_cliente, nombreorazonsocial, nombre,"
    cons = cons & " dbo.f_saldo( id_cliente) as saldo, domicilio, cuit, telefono, "
    cons = cons & " dbo.f_saldoanterior( id_cliente, ' " & dtpDesde.Value & " ' ) as saldoanterior "
    cons = cons & "from cliente c, ciudad ciu "
    cons = cons & " Where ciu.id_ciudad = c.id_ciudad "
    If chkTodos.Value = 0 Then
         cons = cons & " and id_cliente = " & txtCliente1.text
    End If
    cons = cons & sSaldo
    cons = cons & " order by nombreorazonsocial } "
    cons = cons & " AS cmdResumen "
    cons = cons & " APPEND ({ select id_cliente, nro_transaccion, "
    cons = cons & " tipo , fecha, debe, haber, comprobante, concepto, isnull(contado,0) as contado, "
    cons = cons & "dbo.f_saldoatransaccion( id_cliente, nro_transaccion)  as saldoacumulado "
    cons = cons & " from transaccion  "
    cons = cons & " where fecha  >= ' " & dtpDesde.Value & " ' and fecha  <= ' " & dtpHasta.Value & " ' "
    cons = cons & " } AS cmdResumenDetalle "
    cons = cons & " RELATE 'id_cliente' TO 'id_cliente') AS cmdResumenDetalle "
    Dte.Commands("cmdResumen").CommandText = cons
    Dte.Commands("cmdResumen").Execute
   ' rptResumenFacturasCliente.Orientation = rptOrientPortrait
    rptResumenFacturasCliente.Show vbModal
    
End If
End Sub

Private Sub cmdSalir_Click()
Unload Me
End Sub

Private Sub Form_Load()
Conectar
dtpDesde.Value = Date - 30
dtpHasta.Value = Date
End Sub




